package com.example.demo.contrller;

import com.example.demo.contrller.data.ReturnData;
import com.example.demo.demos.Banner;
import com.example.demo.service.BannerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
@RestController
public class BannerController {
    @Resource
    BannerService bannerService;
    @GetMapping("/getBanner")
    public ReturnData getBanner(){
        return bannerService.getBanner();
    }
    @PostMapping("/banner/delete")
    public ReturnData delete(@RequestBody Banner banner){
        return bannerService.delete(banner.getId());
    }
    @PostMapping("/banner/add")
    public ReturnData add(@RequestBody Banner banner){
        return bannerService.add(banner);
    }
}
